const { DataTypes } = require("sequelize");
const seq = require("../db/seq");

const News = seq.define("newsP_news", {
  title: {
    type: DataTypes.STRING,
    unique: true,
    allowNull: false,
    comment: "标题",
  },
  content: {
    type: DataTypes.TEXT,
    allowNull: false,
    comment: "内容",
  },
  category: {
    type: DataTypes.INTEGER,
    allowNull: false,
    comment: "类别1,2,3",
  },
  cover: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: "封面",
  },
  isPublish: {
    type: DataTypes.INTEGER,
    allowNull: false,
    comment: "未发布,已发布",
  },
  editTime: {
    type: DataTypes.DATE,
    allowNull: false,
    comment: "修改时间",
  },
});

// News.sync({ force: true });

module.exports = News;
